package point

import (
	"os/exec"
	"strings"
)

type ChipIdPoint struct{}

func NewChipIdPoint() *ChipIdPoint { return &ChipIdPoint{} }

func (m *ChipIdPoint) Get() any {
	getChipId := func() string {
		output, err := exec.Command("cat", "/etc/machine-id").Output()
		if err != nil {
			return ""
		}

		return strings.TrimSuffix(string(output), "\n")
	}

	return getChipId()
}

func (m *ChipIdPoint) Set(...any) bool { return false }

func (m *ChipIdPoint) SetRoute(string) PointInterface { return m }
